package com.dsiab.portalService.service.impl;

import com.dsiab.portalService.mapper.NavigationDao;
import com.dsiab.portalService.service.NavigationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
@Slf4j
public class NavigationServiceImpl implements NavigationService {

  @Autowired
  NavigationDao navigationDao;

  public List<Map> getAll() {
    List<Map> cateList = navigationDao.getCate();
    for (Map cate: cateList){
      cate.put("children", navigationDao.getListByCate(cate.get("id").toString()));
    }
    return cateList;
  }

}
